{{template "admin/public/head.html" .}}
<section>
	<aside>
		{{template "admin/public/nav.html" .}}
	</aside>
		<article>
		<div class="top-title">
			<dl>
				<dt><h1>{{.title}}</h1></dt>
				<dd>&nbsp;</dd>
			</dl>
		</div>
		<div class="nav1">
			<ul>
				<a href="/admin/index/ad"><li {{if eq .pid ""}}class="no"{{end}}>全部栏目</li></a>
				{{range .platform}}
				<a href="/admin/index/ad?pid={{.id}}"><li {{if eq $.pid .id}}class="no"{{end}}>{{.name}}</li></a>
				{{end}}
			</ul>
		</div>
			<div class="content">
				<div class="release">
				<dl>
					<dt><i class="iconfont">&#xe649;</i> <b>{{.title}}说明</b><br>
						广告是显示在各个平台之上,不同频道的轮播图<br>
						<p>请在上传的时候选择好具体的平台和频道,名称可以用于管理员自己识别到底是哪个广告,<mark>链接请务必填写</mark>,不然广告点击无跳转,
							排序数值大的广告将优先显示,<mark>不可见的广告将不会在各个平台之间显示</mark></p>
						<a href="/admin/index/ad_help" target="view_window" style="color:#a87848">链接帮助</a>
					</dt>
					<dd><a href="/admin/index/ad_add"><button type="button" class="button">添加广告</button></a></dd>
				</dl>
				</div>
				<table class="table">
					<thead><th width="30%">显示信息</th><th width="55%">内容</th><th width="15%">操作</th></thead>
					{{range .info}}
					<tr id="{{.id}}">
						<td>
							名称：{{.name}}<br>
							平台：{{.pname}}<br>
							频道：{{.cname}}<br>
							链接：{{.url}}<br>
							排序：{{.sort}}<br>
							时间：{{.addtime}}
						</td>
						<td><a href="{{.pathname}}"><img src="{{.pathname}}" class="img-5"></a></td>
						<td class="operation">
							<a href="/admin/index/ad_edit?id={{.id}}">编辑</a><br>
							{{if eq .type "1"}}
							<a class="type" data-id="{{.id}}">可见</a>
							{{else}}
							<a class="type" data-id="{{.id}}">不可见</a>
							{{end}}<br>
							<a class="del" data-id="{{.id}}">删除</a>
						</td>
					</tr>
					{{end}}
					{{if ne .paginator.totalpages 1}}
					<tr>
						<td  colspan="5">
							<div class="paging">
								{{if ne .paginator.currpage 1}}
								<a href="{{$.url}}page={{.paginator.firstpage}}">首页</a>
								<a href="{{$.url}}page={{.paginator.prevpage}}">&lt;&lt;</a>
								{{else}}
								<a class="disable">首页</a>
								<a class="disable">&lt;&lt;</a>
								{{end}}
								{{range $index,$page := .paginator.pages}}
								{{if eq $.paginator.currpage $page}} 
								<a class="no">{{$page}}</a>
								{{else}}
								<a href="{{$.url}}page={{$page}}">{{$page}}</a>
								{{end}}
								{{end}}
								{{if eq .paginator.currpage .paginator.totalpages}}
								<a class="disable">&gt;&gt;</a>
								<a class="disable">尾页</a>
								{{else}}
								<a href="{{$.url}}page={{.paginator.nextpage}}">&gt;&gt;</a>
								<a href="{{$.url}}page={{.paginator.totalpages}}">尾页</a>
								{{end}}
							</div>
						</td>
					</tr>
					{{end}}
				</table>
			</div>
			<!-- 系统配置 -->
		</article>
	</section>

	<footer><!-- 系统监控内容 --></footer>
	<script src="https://tcsc.oss-cn-hangzhou.aliyuncs.com/static/admin/js/jquery.jedate.min.js"></script>
	<script src="https://tcsc.oss-cn-hangzhou.aliyuncs.com/static/admin/js/toast.js"></script>
	<script src="https://tcsc.oss-cn-hangzhou.aliyuncs.com/static/admin/js/uppic.js"></script>
	<script src="https://tcsc.oss-cn-hangzhou.aliyuncs.com/static/admin/js/xcConfirm.js"></script>
	<script src="https://tcsc.oss-cn-hangzhou.aliyuncs.com/static/admin/js/app.js"></script>
	<script>
	$('.del').click(function(){
		var id=$(this).attr('data-id');
		wxc.xcConfirm("您确定要删除这条数据吗?","confirm",{onOk:function(){
			$.ajax({
				url:'/admin/delete',
				data:{table:'mt_ad',id:id},
				type:'get',
				success:function(res) {
					if(res==1){
						showMessage('删除成功');
						$('#'+id).css('display','none');
					}else{
						wxc.xcConfirm("操作失败,请重试","error");
					}
				}
			})	
		}});
	})
	$('.type').click(function(){
		var id=$(this).attr('data-id');
		var that=$(this)
		// wxc.xcConfirm("您确定要删除这条数据吗?","confirm",{onOk:function(){
			$.ajax({
				url:'/admin/change',
				data:{table:'mt_ad',id:id,status:"type"},
				type:'get',
				success:function(res) {
					if(res.status==1){
						that.html(res.info)
					}else{
						wxc.xcConfirm("操作失败,请重试","error");
					}
				}
			})	
		// }});
	})
	</script>
</body>
</html>
